package Practice06.test4;

public class Sanj {
    private int a;
    private int b;
    private int c;

    public Sanj(int a, int b, int c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    public void check(){
        if (a+b<=c || a+c<=b || b+c<=a){
            try {
                throw new IllegalArgumentException(a+"   "+b+"   "+c+"不能构成三角形");
            } catch (IllegalArgumentException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public double getArea(){
       check();
       double p;
       p = (a+b+c) / 2.0;
       return Math.sqrt(p*(p-a)*(p-b)*(p-c));
    }

    public String showInfo(){
        return Integer.toString(a)+"   "+Integer.toString(b)+"   "+Integer.toString(c);
    }
}
